package com.service.impl;

import com.Dto.CounselorInfoDto;
import com.Dto.GuidanceSessionOfCounselorDto;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mapper.*;
import com.pojo.*;
import com.pojo.CounselingSession;
import com.service.CounselorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;


/**
 * 咨询师相关功能
 */
@Service
public class CounselorServiceImpl extends ServiceImpl<CounselorMapper, Counselor> implements CounselorService {

    //查询咨询师的排班
    @Autowired
    private CounselorMapper counselorMapper;

    @Autowired
    private CounselorSchedulingMapper counselorSchedulingMapper;

    @Autowired
    private CounselingSessionMapper counselingSessionMapper;

    @Autowired
    private GuidanceSessionMapper guidanceSessionMapper;

    @Autowired
    private CounselorInfoMapper counselorInfoMapper;


    public List<LocalDate> getDatesByUserIdAndCurrentMonth(Integer userId){
            Counselor counselor = counselorMapper.findCounselorByUserId(userId);

        List<LocalDate> dateList = counselorSchedulingMapper.findDatesByCounselorId(counselor.getId());
            return dateList;
    }
    public List<CounselingSession> getCounselingSessionsByUserId(Integer userId){
        Counselor counselor = counselorMapper.findCounselorByUserId(userId);

        List<CounselingSession> counselingSessions = counselingSessionMapper.findCounselingSessionsByCounselorId(counselor.getId());
        return counselingSessions;

    }
    public List<GuidanceSessionOfCounselorDto> getGuidanceSessionByUserId(Integer userId){
        Counselor counselor = counselorMapper.findCounselorByUserId(userId);

        List<GuidanceSessionOfCounselorDto> guidanceSessions = guidanceSessionMapper.getGuidanceSessionsByCounselor(counselor.getId());

        return guidanceSessions;

    }

    public List<CounselorInfoDto> getCounselorInfoByUserId(Integer userId){
        Counselor counselor = counselorMapper.findCounselorByUserId(userId);

        List<CounselorInfoDto> counselorInfo = counselorInfoMapper.findCounselorInfo(counselor.getId());

        return counselorInfo;

    }

}
